#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
using namespace std;
int n = 0;
int count = 0;
long long arr[123456789];
int main()
{
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
        if (arr[i] == 1) 
            count++;
    }
    if (count >= 1)
    {
        cout << (n - count);
        return 0;
    }

    return 0;
}